Package("web.common.queryArea")
web.common.queryArea={
	
	//区省、市、区parentId 父Id,level 级别 ,selectId select的id
	getAreaData :  function(parentId,level,selectId){
		$("#"+selectId).html("");
		if(level == "2"){
			$("#"+selectId).append("<option value=''>请选择市</option>");
		}else if(level == "3"){
			$("#"+selectId).append("<option value=''>请选择区/县</option>");
		}
		$.ajax({
			 type:"POST",
			 url:ctx+"/area/getArea",
			 data:{"parentId":parentId,"level":level},
			 success:function(data){
				 	var areaList=data.areaList;
				 	if(areaList){
				 		for(var i=0;i<areaList.length;i++){
				 			$("#"+selectId).append("<option value='"+
				 					areaList[i].id+"'>"+
				 					areaList[i].name+"</option>");
				 		}
				 	}
				}
			 });
	 },
	 
	 //针对编辑信息第一次出现
	 getAreaDataUp:function(level,selectId,city){
		 $("#"+selectId).html("");
		 if(!city){
			$("#"+selectId).append("<option value=''>请选择省</option>");
		 }
		 $.ajax({
			 type:"POST",
			 url:ctx+"/area/getArea",
			 data:{"level":level},
			 success:function(data){
				 	var areaList=data.areaList;
				 	if(areaList){
				 		for(var i=0;i<areaList.length;i++){
				 			var selected="";
				 			if(city == areaList[i].name){
				 				 selected="selected='selected'";
				 			}
				 			$("#"+selectId).append("<option value='"+
				 					areaList[i].id+"' "+selected+">"+
				 					areaList[i].name+"</option>");
				 		}
				 	}
				}
			 });
	 },
	 
	 getAreaParaDataUp:function(parentId,level,selectId,city,optonValue){
		 $("#"+selectId).html("");
		 if(!city){
			$("#"+selectId).append("<option value=''>"+optonValue+"</option>");
		 }
		 $.ajax({
			 type:"POST",
			 url:ctx+"/area/getArea",
			 data:{"level":level,"parentId":parentId},
			 success:function(data){
				 	var areaList=data.areaList;
				 	if(areaList){
				 		for(var i=0;i<areaList.length;i++){
				 			var selected="";
				 			if(city == areaList[i].name){
				 				 selected="selected='selected'";
				 			}
				 			$("#"+selectId).append("<option value='"+
				 					areaList[i].id+"' "+selected+">"+
				 					areaList[i].name+"</option>");
				 		}
				 	}
				}
			 });
	 },
	 
	//区域
	 getlargeAreaUp:function(selectId){
		 $("#"+selectId).html("");
		 $("#"+selectId).append("<option value=''>全部区域</option>");
		 $.ajax({
			 type:"POST",
			 url:ctx+"/area/getArea",
			 data:{"level":3},
			 success:function(data){
				 	var areaList=data.areaList;
				 	if(areaList){
				 		for(var i=0;i<areaList.length;i++){
				 			$("#"+selectId).append("<option value='"+
				 					areaList[i].id+"'>"+
				 					areaList[i].name+"</option>");
				 		}
				 	}
				}
			 });
	 },
	 
	 //板块
	 getsmallAreaUp:function(parentId,level,selectId){
		 $("#"+selectId).html("");
		 $("#"+selectId).append("<option value=''>全部板块</option>");
		 $.ajax({
			 type:"POST",
			 url:ctx+"/area/getArea",
			 data:{"parentId":parentId,"level":level},
			 success:function(data){
				 	var areaList=data.areaList;
				 	if(areaList){
				 		for(var i=0;i<areaList.length;i++){
				 			$("#"+selectId).append("<option value='"+
				 					areaList[i].id+"'>"+
				 					areaList[i].name+"</option>");
				 		}
				 	}
				}
			 });
	 }
	 
}